export function commonHook () {
    const randomValue = (min,max) => {
        return Math.floor(Math.random()*(max-min+1) + min)
    }

    const calcBaseFontsize = () => {
        const baseWidth = 1920
        const baseFontSize = 16

        // 当前屏幕宽度
        const currentWidth = window.innerWidth

        // 计算字体缩放比例
        const scale = currentWidth / baseWidth

        if(currentWidth > 768) {
            document.documentElement.style.fontSize = `${baseFontSize * scale}px`
        } else {
            document.documentElement.style.fontSize = '16px'
        }
    }

    return {
        randomValue,
        calcBaseFontsize
    }
}